package 相向双指针

//	func reverseSubmatrix(grid [][]int, x int, y int, k int) [][]int {
//		n := y + k
//		for y <= n {
//			left := x
//			right := x + k
//			for left < right {
//				grid[y][left], grid[y][right] = grid[y][right], grid[y][left]
//				left++
//				right--

//			}
//		}
//		return grid
//	}
func reverseSubmatrix(grid [][]int, x, y, k int) [][]int {
	l, r := x, x+k-1
	for l < r {
		for j := y; j < y+k; j++ {
			grid[l][j], grid[r][j] = grid[r][j], grid[l][j]
		}
		l++
		r--
	}
	return grid
}
